<template>
	<view class="" style="background-color: #d70127;">
		<view class="content">
			<view class="" style="font-weight: 600;color: #FDE8CE;text-align: center;"> 我的上级 </view>
			<view class="" style="padding: 20rpx 50rpx;display: flex;justify-content: space-between;color: #FDE8CE;"
				v-if="mainData.mySuperior">
				<view class="u-line-1" style=""> {{mainData.mySuperior.realname}} </view>
				<view class=""> {{mainData.mySuperior.phone}} </view>
			</view>
			<view class="" style="padding: 20rpx 50rpx;display: flex;justify-content: center;color: #FDE8CE;" v-else>
				暂无数据~ </view>
			<view class="tabs">
				<view class="tablist" :class="actIndex==1?'active':''" @click="actIndex=1"> 我的直推({{firstRecLength}}人)
				</view>
				<view class="tablist" :class="actIndex==2?'active':''" @click="actIndex=2"> 我的间推({{secondRecLength}}人)
				</view>
			</view>
			<view class="staffmode" v-if="actIndex==1">
				<scroll-view scroll-y="true" style="height: 1000rpx;">
					<view class="stafflist" v-for="(item,indexc) in mainData.firstRec" :key="indexc">
						<view class="infodata">
							<view class="name u-line-1">
								{{item.userInfo.realname}}
								<text class="phone">{{item.userInfo.phone}}</text>
							</view>
							<view class="time">
								{{item.createTime}}
							</view>
						</view>
					</view>
				</scroll-view>
				<!-- 	<view class="" v-if="mainData.firstRec.length==0"
				style="display: flex;justify-content: center;margin-top: 400rpx;">
				<image src="/static/image/empty.png" mode="widthFix" style="width: 500rpx;"></image>
			</view> -->
			</view>
			<view class="staffmode" v-if="actIndex==2">
				<scroll-view scroll-y="true" style="height: 1000rpx;">
					<view class="stafflist" v-for="(item,indexc) in mainData.secondRec" :key="indexc">
						<!-- 		<image :src="item.memberUrl" mode="widthFix" v-if="item.memberUrl"></image>
					<image src="/static/logo.png" mode="widthFix" v-else></image> -->
						<view class="infodata">
							<view class="name">
								{{item.userInfo.realname}}
								<text class="phone">{{item.userInfo.phone}}</text>
							</view>
							<view class="time">
								{{item.createTime}}
							</view>
						</view>
					</view>
				</scroll-view>
				<!-- 	<view class="" v-if="mainData.secondRec.length==0"
				style="display: flex;justify-content: center;margin-top: 400rpx;">
				<image src="/static/image/empty.png" mode="widthFix" style="width: 500rpx;"></image>
			</view> -->
			</view>
		</view>
	</view>
</template>
<script>
	import {
		myRecommend
	} from '../request/api.js'
	export default {
		data() {
			return {
				actIndex: 1,
				mainData: {},
				firstRecLength: 0,
				secondRecLength: 0
			};
		},
		onLoad() {
			this.getmyRecommend();
		},
		methods: {
			getmyRecommend() {
				myRecommend({
					memberId: uni.getStorageSync('userInfo').id,
				}).then(res => {
					if (res.code == 200) {
						this.mainData = res.result;
						this.firstRecLength = this.mainData.firstRec.length
						this.secondRecLength = this.mainData.secondRecLength.length
					}
				})
			},
		}
	}
</script>
<style lang="scss" scoped>
	.content {
		padding-top: 50rpx;
		min-height: 100vh;
		background: url('/static/image/bg2.png') no-repeat center center;
		background-size: 100% 100%;

		// overflow: hidden;
		.tabs {
			display: flex;
			justify-content: space-around;
			padding: 50rpx 30rpx 20rpx;
			box-sizing: border-box;
			// position: fixed;
			// top: 0;
			// left: 0;
			width: 100%;
			// background-color: #252026;
			z-index: 9999;
			color: #FDE8CE;

			.tablist {
				position: relative;
			}

			.active::after {
				position: absolute;
				bottom: -10rpx;
				width: 76rpx;
				height: 4rpx;
				content: " ";
				border-radius: 2rpx;
				background: #FDE8CE;
				left: 9rpx;
			}
		}

		.staffmode {
			margin: 20rpx;
			// background: #fff;
			padding: 20rpx;
			// margin-top: 38rpx;
			border-radius: 20rpx;
			min-height: 200rpx;

			.stafflist {
				// display: flex;
				position: relative;
				padding: 30rpx 0;
				border-bottom: 1rpx solid #f1f1f1;
				color: #FDE8CE;

				image {
					width: 118rpx;
					height: 118rpx;
					border-radius: 50%;
				}

				.infodata {
					margin-left: 10rpx;
					width: 550rpx;

					.name {
						font-size: 40rpx;

						.phone {
							font-size: 28rpx;
							margin-left: 20rpx;
						}
					}

					.time {
						font-size: 28rpx;
						margin-top: 10rpx;
					}
				}

				.number {
					position: absolute;
					right: 0;
					font-size: 40rpx;
					padding-top: 20rpx;
				}
			}
		}
	}

	.infodata {
		margin-left: 10rpx;
		width: 550rpx;

		.name {
			font-size: 40rpx;

			.phone {
				font-size: 28rpx;
				margin-left: 20rpx;
			}
		}

		.time {
			font-size: 28rpx;
			margin-top: 10rpx;
		}
	}
</style>